﻿using Frame.Core.IServices.Admin;
using Frame.Core.Models;
using Frame.Core.Repository;
using System;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Frame.Core.Services.Admin
{
    public class PowerService : BaseService<Powers>, IPowerService
    {
        readonly IRepositoryBase<Powers> _dal;
        readonly IRepositoryBase<RolePowers> _rolePowerRepository;


        public PowerService(IRepositoryBase<Powers> dal, IRepositoryBase<RolePowers> rolePowerRepository)
        {
            this._dal = dal;
            base.BaseDal = dal;
            _rolePowerRepository = rolePowerRepository;
        }
        public async Task<long> GetRolePowersCountById(int powerID)
        {
            return await _rolePowerRepository.Select.Where(a => a.PowerID == powerID).CountAsync();
        }
    }
}
